# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtscript
pkgver=5.15.4_git20210316
pkgrel=0
_commit="5cec94b2c1503f106f4ef4778d016410ebb86211"
pkgdesc="Qt5 - QtScript component"
url="https://www.qt.io/developers/"
arch="all"
license="(LGPL-2.0-or-later OR GPL-3.0-only OR GPL-2.0-or-later) AND Qt-GPL-exception-1.0"
makedepends="qt5-qtbase-dev linux-headers"
subpackages="$pkgname-dev"
builddir="$srcdir/qtscript-$_commit"

case $pkgver in
	*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://invent.kde.org/qt/qt/qtscript/-/archive/$_commit/qtscript-$_commit.tar.gz
	qtscript-everywhere-src-5.10.1-sgidefs.patch
	qtscript-s390x.patch
	"

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5
	make
}

check() {
	make check
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

	install -d "$pkgdir"/usr/share/licenses
	ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
46348a8fe6cf481c2a42495c3fbf523a026091fbadfcbe89d197b0732a1277bec06b368b566e3c3b0c2d50f4d33b2de152ad7e122640d228c98cfa6f1df022bc  qtscript-5cec94b2c1503f106f4ef4778d016410ebb86211.tar.gz
c89124fc940ceaa5cfc52c8f48b8eef17bba575a080fad3f27d61e3da98ab5cfd4bb6ffaae09ccae81f6f7644719fa28d38d4b7a7fe4cdb4268673c39627eb22  qtscript-everywhere-src-5.10.1-sgidefs.patch
a0a22824954d35495d9d08c2b82d6eeeec26765760d417b8bc72c51e1753d4bb9f5e55d5289001d2d6071669a0bfd4f856fc3d0cf58b509bcbcd5211df35e482  qtscript-s390x.patch
"
